//
//  BaseTableViewController.swift
//  swift_wobo
//
//  Created by yuxin on 2018/11/15.
//  Copyright © 2018 wuxiantianli. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController, VisitorViewDelegate {
    
    var visitorView : VisitorView?
    override func loadView() {
        UserAccount.isLogin() ? super.loadView() : setupVisitor()
    }
    
    private func setupVisitor() {
        visitorView = VisitorView()
        visitorView?.delegate = self
        view = visitorView
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: .plain, target: self, action: #selector(visitorViewRegister))
        
         navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登陆", style: .plain, target: self, action: #selector(visitorViewLogin))
    }
    
    //MARK: - VisitorViewDelegate
    @objc  func visitorViewLogin() {
        print(#function)
    }
    
    @objc  func visitorViewRegister() {
        print(#function)
    }

}
